% ---- Time averaged map at surface               
m=squeeze(nanmean(log10(nmodel.data(:,:,:)),3));      
m(m==0)=NaN;                        
d=squeeze(nanmean(dat.data(:,:,:),3));
di=10.^m-10.^d;
mi=-1;
ma=1;

milat=-20;
malat=80;
milon=-98;
malon=52;


%md=2*nanstd(nanstd(abs(m-d)));
md=.5;

close all
gccolor('mp',nmodel.lon,nmodel.lat,m','on',mi,ma,['Model ',kind,' ',parameter,' ',cruise,' - Surface (log10(mgChl.m^{-3}))'],milat,malat,milon,malon)    
printgc('-f1','-depsc2',['./PLOT_VALIDATION/SATELLITE/SEAWIFS_',bbio,'_model_',parameter,'_surf_',year,'.eps'])
close all
gccolor('mp',dat.londata,dat.latdata,d','on',mi,ma,['Data ',kind,' ',parameter,' ',cruise,' - Surface (log10(mgChl.m^{-3}))'],milat,malat,milon,malon)    
printgc('-f1','-depsc2',['./PLOT_VALIDATION/SATELLITE/SEAWIFS_',bbio,'_data_',parameter,'_surf_',year,'.eps'])
close all
gccolor('mp',dat.londata,dat.latdata,di','on',-md,md,['(Model-Data) ',kind,' ',parameter,' ',cruise,' - Surface (mgChl.m^{-3})'],milat,malat,milon,malon)    
load cmap_politoliu
colormap(politoliu)
printgc('-f1','-depsc2',['./PLOT_VALIDATION/SATELLITE/SEAWIFS_',bbio,'_diff_',parameter,'_surf_',year,'.eps'])
close all

return

% ---- Figure de comparaison 

% - Aumont
figure
aumont=[0 0.02 0.04 0.06 0.08 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.5 2 2.5 3];
m_proj('equidistant','lat',[min(min(nmodel.lat)) max(max(nmodel.lat))],'lon',[min(min(nmodel.lon)) max(max(nmodel.lon))]);
[C,h]=m_contourf(nmodel.lon,nmodel.lat,squeeze(nanmean(nmodel.data(:,:,:),3))',aumont);
clabel(C,h,'manual')

%shading flat
m_coast('patch',[.6 .6 .6]);
m_grid('linestyle',':','box','fancy','tickdir','in','Fontsize',12);            
cbarf(squeeze(nanmean(nmodel.data(:,:,:),3))',aumont,'vertical','nonlinear');
set(gcf,'Renderer','zbuffer')

% - Oschlies

% -- Annual
figure
oschlies=[0 0.01 0.1 0.2 0.5 1 2 5];
m_proj('equidistant','lat',[min(min(nmodel.lat)) max(max(nmodel.lat))],'lon',[min(min(nmodel.lon)) max(max(nmodel.lon))]);
[C,h]=m_contourf(nmodel.lon,nmodel.lat,squeeze(nanmean(nmodel.data(:,:,:),3))',oschlies);
%shading flat
clabel(C,h,'manual')
m_coast('patch',[.6 .6 .6]);
m_grid('linestyle',':','box','fancy','tickdir','in','Fontsize',12);            
cbarf(squeeze(nanmean(nmodel.data(:,:,:),3))',oschlies,'vertical','nonlinear');

% -- Seasonal
d=datevec(nmodel.time);
jmf=find(d(:,2)==1 | d(:,2)==2 | d(:,2)==3);
amj=find(d(:,2)==4 | d(:,2)==5 | d(:,2)==6);
jas=find(d(:,2)==7 | d(:,2)==8 | d(:,2)==9);
ond=find(d(:,2)==10 | d(:,2)==11 | d(:,2)==12);



figure
m_proj('equidistant','lat',[min(min(nmodel.lat)) max(max(nmodel.lat))],'lon',[min(min(nmodel.lon)) max(max(nmodel.lon))]);
[C,h]=m_contourf(nmodel.lon,nmodel.lat,squeeze(nanmean(nmodel.data(:,:,jmf),3))',oschlies);
%shading flat
clabel(C,h,'manual')
m_coast('patch',[.6 .6 .6]);
m_grid('linestyle',':','box','fancy','tickdir','in','Fontsize',12);         
title('winter')   
cbarf(squeeze(nanmean(nmodel.data(:,:,jmf),3))',oschlies,'vertical','nonlinear');



figure
m_proj('equidistant','lat',[min(min(nmodel.lat)) max(max(nmodel.lat))],'lon',[min(min(nmodel.lon)) max(max(nmodel.lon))]);
[C,h]=m_contourf(nmodel.lon,nmodel.lat,squeeze(nanmean(nmodel.data(:,:,amj),3))',oschlies);
%shading flat
clabel(C,h,'manual')
m_coast('patch',[.6 .6 .6]);
m_grid('linestyle',':','box','fancy','tickdir','in','Fontsize',12); 
title('spring')           
cbarf(squeeze(nanmean(nmodel.data(:,:,amj),3))',oschlies,'vertical','nonlinear');
set(gcf,'Renderer','zbuffer')


figure
m_proj('equidistant','lat',[min(min(nmodel.lat)) max(max(nmodel.lat))],'lon',[min(min(nmodel.lon)) max(max(nmodel.lon))]);
[C,h]=m_contourf(nmodel.lon,nmodel.lat,squeeze(nanmean(nmodel.data(:,:,jas),3))',oschlies);
%shading flat
clabel(C,h,'manual')
m_coast('patch',[.6 .6 .6]);
m_grid('linestyle',':','box','fancy','tickdir','in','Fontsize',12); 
title('summer')           
cbarf(squeeze(nanmean(nmodel.data(:,:,jas),3))',oschlies,'vertical','nonlinear');

figure
m_proj('equidistant','lat',[min(min(nmodel.lat)) max(max(nmodel.lat))],'lon',[min(min(nmodel.lon)) max(max(nmodel.lon))]);
[C,h]=m_contourf(nmodel.lon,nmodel.lat,squeeze(nanmean(nmodel.data(:,:,ond),3))',oschlies);
%shading flat
clabel(C,h,'manual')
m_coast('patch',[.6 .6 .6]);
m_grid('linestyle',':','box','on','tickdir','in','Fontsize',12); 
%title('fall')           
cbarf(squeeze(nanmean(nmodel.data(:,:,ond),3))',oschlies,'vertical','nonlinear');

% -- 4 - 12 Avril
figure
m_proj('equidistant','lat',[min(min(nmodel.lat)) max(max(nmodel.lat))],'lon',[min(min(nmodel.lon)) max(max(nmodel.lon))]);
[C,h]=m_contourf(nmodel.lon,nmodel.lat,squeeze(nanmean(nmodel.data(:,:,13:14),3))',oschlies);
%shading flat
clabel(C,h,'manual')
m_coast('patch',[.6 .6 .6]);
m_grid('linestyle',':','box','on','tickdir','in','Fontsize',12); 
title('April')           
cbarf(squeeze(nanmean(nmodel.data(:,:,13:14),3))',oschlies,'vertical','nonlinear');


% - Berline
figure
berline=[0.01 0.05 0.1 0.2 0.4 0.6 1 2 5];
m_proj('equidistant','lat',[min(min(nmodel.lat)) max(max(nmodel.lat))],'lon',[min(min(nmodel.lon)) max(max(nmodel.lon))]);
[C,h]=m_contourf(nmodel.lon,nmodel.lat,squeeze(nanmean(nmodel.data(:,:,amj),3))',berline);
%shading flat
clabel(C,h,'manual')
m_coast('patch',[.6 .6 .6]);
m_grid('linestyle',':','box','fancy','tickdir','in','Fontsize',12);            
cbarf(squeeze(nanmean(nmodel.data(:,:,amj),3))',berline,'vertical','nonlinear');
set(gcf,'Renderer','zbuffer')



% - Charria
figure
charria=[0.03 0.1 0.3 1 3];
m_proj('equidistant','lat',[min(min(nmodel.lat)) max(max(nmodel.lat))],'lon',[min(min(nmodel.lon)) max(max(nmodel.lon))]);
m_pcolor(nmodel.lon,nmodel.lat,squeeze(nanmean(log10(nmodel.data(:,:,amj)),3))');
shading flat
%clabel(C,h,'manual')
m_coast('patch',[.6 .6 .6]);
m_grid('linestyle',':','box','fancy','tickdir','in','Fontsize',12);            
%cbarf(squeeze(nanmean(log10(nmodel.data(:,:,amj)),3))',charria,'vertical','nonlinear');
caxis([-1.5229 0.4771])
colorbar


% - Gregg


jan=find(d(:,2)==1);
mar=find(d(:,2)==3);
jun=find(d(:,2)==6);
jul=find(d(:,2)==7);


figure
gregg=[0 0.01 0.05 0.08 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.6 0.7 0.8 0.9 1 1.5 3 5 7.5 10];
m_proj('equidistant','lat',[min(min(nmodel.lat)) max(max(nmodel.lat))],'lon',[min(min(nmodel.lon)) max(max(nmodel.lon))]);
[C,h]=m_contourf(nmodel.lon,nmodel.lat,squeeze(nanmean(nmodel.data(:,:,jan),3))',gregg);
%shading flat
clabel(C,h,'manual')
m_coast('patch',[.6 .6 .6]);
m_grid('linestyle',':','box','fancy','tickdir','in','Fontsize',12);            
cbarf(squeeze(nanmean(nmodel.data(:,:,jan),3))',gregg,'vertical','nonlinear');

figure
gregg=[0 0.01 0.05 0.08 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.6 0.7 0.8 0.9 1 1.5 3 5 7.5 10];
m_proj('equidistant','lat',[min(min(nmodel.lat)) max(max(nmodel.lat))],'lon',[min(min(nmodel.lon)) max(max(nmodel.lon))]);
[C,h]=m_contourf(nmodel.lon,nmodel.lat,squeeze(nanmean(nmodel.data(:,:,mar),3))',gregg);
%shading flat
clabel(C,h,'manual')
m_coast('patch',[.6 .6 .6]);
m_grid('linestyle',':','box','fancy','tickdir','in','Fontsize',12);            
cbarf(squeeze(nanmean(nmodel.data(:,:,mar),3))',gregg,'vertical','nonlinear');


figure
gregg=[0 0.01 0.05 0.08 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.6 0.7 0.8 0.9 1 1.5 3 5 7.5 10];
m_proj('equidistant','lat',[min(min(nmodel.lat)) max(max(nmodel.lat))],'lon',[min(min(nmodel.lon)) max(max(nmodel.lon))]);
[C,h]=m_contourf(nmodel.lon,nmodel.lat,squeeze(nanmean(nmodel.data(:,:,jun),3))',gregg);
%shading flat
clabel(C,h,'manual')
m_coast('patch',[.6 .6 .6]);
m_grid('linestyle',':','box','fancy','tickdir','in','Fontsize',12);            
cbarf(squeeze(nanmean(nmodel.data(:,:,jun),3))',gregg,'vertical','nonlinear');


figure
gregg=[0 0.01 0.05 0.08 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.6 0.7 0.8 0.9 1 1.5 3 5 7.5 10];
m_proj('equidistant','lat',[min(min(nmodel.lat)) max(max(nmodel.lat))],'lon',[min(min(nmodel.lon)) max(max(nmodel.lon))]);
[C,h]=m_contourf(nmodel.lon,nmodel.lat,squeeze(nanmean(nmodel.data(:,:,jul),3))',gregg);
%shading flat
clabel(C,h,'manual')
m_coast('patch',[.6 .6 .6]);
m_grid('linestyle',':','box','fancy','tickdir','in','Fontsize',12);            
cbarf(squeeze(nanmean(nmodel.data(:,:,jul),3))',gregg,'vertical','nonlinear');







